package com.zzp.zjs_bos.web.action;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.zzp.zjs_bos.domain.Noticebill;
import com.zzp.zjs_bos.domain.User;
import com.zzp.zjs_bos.utils.BOSContext;
import com.zzp.zjs_bos.web.action.base.BaseAction;

import cn.itcast.crm.domain.Customer;
import cn.itcast.crm.service.CustomerService;

@Controller
@Scope("prototype")
public class NoticebillAction extends BaseAction<Noticebill> {
	
	@Resource
	private CustomerService customerService;
	
	private String phone;
	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	
	public String showCustomer(){
		Customer customer = customerService.findByPhone(phone);
		String[] excludes = new String[]{"station"};
		this.writeObject2Json(customer, excludes);
		return NONE;
	}
	
	public String save(){
		User user = BOSContext.getUser();
		model.setUser(user);
		noticebillService.save(model);
		return "toSave";
	}
}
